﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Ball : MonoBehaviour
{
    private PlayerConllter player;
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType<PlayerConllter>();
        Destroy(gameObject, 3);
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            player.GetHit(1);
            Destroy(gameObject);
        }
    }
}
